import {ref,watch} from 'vue';

export const useVModel=(props:any,key:string,emit:any) =>{
  const model=ref(props[key]);
  watch(() => props[key],(val) =>{
    model.value=val;
  })
  watch(model,(val) =>{
    emit(`update:${key}`,val);
  })
  return model;
}